<?php
/**
 * 缓存
 *
 * @since 1.0
 * @package if
 * @subpackage module.cache
 */
class ICache extends IObject {
	/**
	 * 取得缓存引擎
	 *
	 * @param string $engine 引擎名
	 * @return ICacheEngine
	 * @since 1.0
	 */
	static function engine($engine = null) {
		//默认的
		if (!$engine) {
			$engine = o("@cache.default");
		}
		
		//从第三方中找
		$main = o("@cache.3rd_engines.{$engine}");
		if (is_string($main)) {
			return IRegistry::singleton()->single($main);
		}
		
		//系统提供的
		$main = o("@cache.engines.{$engine}");
		if (is_string($main)) {
			return IRegistry::singleton()->single($main);
		}
		
		//找不到
		throw new ICacheException("can't find cache engine '{$engine}'", 0x100066);
	}
}

?>